package com.anlu.hibernate.utils;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtils {

    private static   SessionFactory factory;


    public static SessionFactory getSessionFactory(){
        //creating configuration object
        Configuration cfg=new Configuration();
        cfg.configure("hibernate.cfg.xml");//populates the data of the configuration file

        //creating seession factory object
        if(factory==null){
            factory=cfg.buildSessionFactory();
        }
        return factory;

    }

}
